/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package weka;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import weka.gui.treevisualizer.TreeVisualizer;

/**
 *
 * @author Utilisateur
 */
public class InsererIHM extends JFrame{
    
    public InsererIHM(){
		super();
		build();//On initialise notre fenêtre
	}
    private void build() {
        setTitle("Insertion d'un animal"); //On donne un titre à l'application
        setSize(1024,800); //On donne une taille à notre fenêtre
        setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
        setResizable(true); //On permet le redimensionnement
        getContentPane().setLayout(new BorderLayout());
        //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer lors du clic sur la croix
        Visualisation treeView = new Visualisation("C:/Users/Utilisateur/Documents/NetBeansProjects/weka/titanic.arff");
                
                TreeVisualizer t = treeView.getTree();
                //t.fitToScreen();
                getContentPane().add(t,BorderLayout.CENTER);
                
                //arbre.setBorder(borderArbre);
                getContentPane().add(buildContentPane(),BorderLayout.WEST);
        //setContentPane(buildContentPane());
    }
    
    private JPanel buildContentPane(){
		JPanel panel = new JPanel();
                panel.setLayout(new GridLayout(10,1));
                Border borderForm = BorderFactory.createTitledBorder("Formulaire");
                //Border borderArbre = BorderFactory.createTitledBorder("Arbre");
                //JPanel form = new JPanel();
                panel.setPreferredSize(new Dimension(150, 800));
                //form.setLayout(new GridLayout(4,1));
                /************************************************/
                JCheckBox hair = new JCheckBox();
                ImageIcon checkeddimgHair = new ImageIcon("./images/hairCheck.png");
                ImageIcon uncheckeddimgHair = new ImageIcon("./images/hairUnCheck.png");

                  hair.setIcon(uncheckeddimgHair);
                  hair.setSelectedIcon(checkeddimgHair);
                  hair.setDisabledIcon(uncheckeddimgHair);
                  hair.setDisabledIcon(uncheckeddimgHair);
                  hair.setDisabledSelectedIcon(uncheckeddimgHair);
                  hair.setSelected(false);  
                  
                JCheckBox feathers = new JCheckBox();
                ImageIcon checkeddimgPlume = new ImageIcon("./images/plumeCheck.png");
                ImageIcon uncheckeddimgPlume = new ImageIcon("./images/plumeUnCheck.png");

                  feathers.setIcon(uncheckeddimgPlume);
                  feathers.setSelectedIcon(checkeddimgPlume);
                  feathers.setDisabledIcon(uncheckeddimgPlume);
                  feathers.setDisabledIcon(uncheckeddimgPlume);
                  feathers.setDisabledSelectedIcon(uncheckeddimgPlume);
                  feathers.setSelected(false);  
                  
                JCheckBox eggs = new JCheckBox();
                ImageIcon checkeddimgEgg = new ImageIcon("./images/eggCheck.png");
                ImageIcon uncheckeddimgEgg = new ImageIcon("./images/eggUnCheck.png");

                  eggs.setIcon(uncheckeddimgEgg);
                  eggs.setSelectedIcon(checkeddimgEgg);
                  eggs.setDisabledIcon(uncheckeddimgEgg);
                  eggs.setDisabledIcon(uncheckeddimgEgg);
                  eggs.setDisabledSelectedIcon(uncheckeddimgEgg);
                  eggs.setSelected(false);
                  
                JCheckBox milk = new JCheckBox();
                ImageIcon checkeddimgMilk = new ImageIcon("./images/milkCheck.png");
                ImageIcon uncheckeddimgMilk = new ImageIcon("./images/milkUnCheck.png");

                  milk.setIcon(uncheckeddimgMilk);
                  milk.setSelectedIcon(checkeddimgMilk);
                  milk.setDisabledIcon(uncheckeddimgMilk);
                  milk.setDisabledIcon(uncheckeddimgMilk);
                  milk.setDisabledSelectedIcon(uncheckeddimgMilk);
                  milk.setSelected(false);
                  
                JCheckBox airborne = new JCheckBox();
                ImageIcon checkeddimgAirborne = new ImageIcon("./images/airborneCheck.png");
                ImageIcon uncheckeddimgAirborne = new ImageIcon("./images/airborneUnCheck.png");

                  airborne.setIcon(uncheckeddimgAirborne);
                  airborne.setSelectedIcon(checkeddimgAirborne);
                  airborne.setDisabledIcon(uncheckeddimgAirborne);
                  airborne.setDisabledIcon(uncheckeddimgAirborne);
                  airborne.setDisabledSelectedIcon(uncheckeddimgAirborne);
                  airborne.setSelected(false);
                  
                JCheckBox aquatic = new JCheckBox();
                ImageIcon checkeddimgAquatic = new ImageIcon("./images/aquaticCheck.png");
                ImageIcon uncheckeddimgAquatic = new ImageIcon("./images/aquaticUnCheck.png");

                  aquatic.setIcon(uncheckeddimgAquatic);
                  aquatic.setSelectedIcon(checkeddimgAquatic);
                  aquatic.setDisabledIcon(uncheckeddimgAquatic);
                  aquatic.setDisabledIcon(uncheckeddimgAquatic);
                  aquatic.setDisabledSelectedIcon(uncheckeddimgAquatic);
                  aquatic.setSelected(false);
                  
                JCheckBox predator = new JCheckBox();
                ImageIcon checkeddimgPredator = new ImageIcon("./images/predatorCheck.png");
                ImageIcon uncheckeddimgPredator = new ImageIcon("./images/predatorUnCheck.png");

                  predator.setIcon(uncheckeddimgPredator);
                  predator.setSelectedIcon(checkeddimgPredator);
                  predator.setDisabledIcon(uncheckeddimgPredator);
                  predator.setDisabledIcon(uncheckeddimgPredator);
                  predator.setDisabledSelectedIcon(uncheckeddimgPredator);
                  predator.setSelected(false);
                  
                JCheckBox toothed = new JCheckBox();
                ImageIcon checkeddimgToothed = new ImageIcon("./images/toothedCheck.png");
                ImageIcon uncheckeddimgToothed = new ImageIcon("./images/toothedUnCheck.png");

                  toothed.setIcon(uncheckeddimgToothed);
                  toothed.setSelectedIcon(checkeddimgToothed);
                  toothed.setDisabledIcon(uncheckeddimgToothed);
                  toothed.setDisabledIcon(uncheckeddimgToothed);
                  toothed.setDisabledSelectedIcon(uncheckeddimgToothed);
                  toothed.setSelected(false);
                  
                JCheckBox backbone = new JCheckBox();
                ImageIcon checkeddimgBackbone = new ImageIcon("./images/backboneCheck.png");
                ImageIcon uncheckeddimgBackbone = new ImageIcon("./images/backboneUnCheck.png");

                  backbone.setIcon(uncheckeddimgBackbone);
                  backbone.setSelectedIcon(checkeddimgBackbone);
                  backbone.setDisabledIcon(uncheckeddimgBackbone);
                  backbone.setDisabledIcon(uncheckeddimgBackbone);
                  backbone.setDisabledSelectedIcon(uncheckeddimgBackbone);
                  backbone.setSelected(false);
                  
                JCheckBox breathes = new JCheckBox();
                ImageIcon checkeddimgBreathes = new ImageIcon("./images/breathesCheck.png");
                ImageIcon uncheckeddimgBreathes = new ImageIcon("./images/breathesUnCheck.png");

                  breathes.setIcon(uncheckeddimgBreathes);
                  breathes.setSelectedIcon(checkeddimgBreathes);
                  breathes.setDisabledIcon(uncheckeddimgBreathes);
                  breathes.setDisabledIcon(uncheckeddimgBreathes);
                  breathes.setDisabledSelectedIcon(uncheckeddimgBreathes);
                  breathes.setSelected(false);
                  
                  
                JCheckBox venomous = new JCheckBox();
                ImageIcon checkeddimgVenomous = new ImageIcon("./images/venomousCheck.png");
                ImageIcon uncheckeddimgVenomous = new ImageIcon("./images/venomousUnCheck.png");

                  venomous.setIcon(uncheckeddimgVenomous);
                  venomous.setSelectedIcon(checkeddimgVenomous);
                  venomous.setDisabledIcon(uncheckeddimgVenomous);
                  venomous.setDisabledIcon(uncheckeddimgVenomous);
                  venomous.setDisabledSelectedIcon(uncheckeddimgVenomous);
                  venomous.setSelected(false);
                  
                JCheckBox fins = new JCheckBox();
                ImageIcon checkeddimgFins = new ImageIcon("./images/finsCheck.png");
                ImageIcon uncheckeddimgFins = new ImageIcon("./images/finsUnCheck.png");

                  fins.setIcon(uncheckeddimgFins);
                  fins.setSelectedIcon(checkeddimgFins);
                  fins.setDisabledIcon(uncheckeddimgFins);
                  fins.setDisabledIcon(uncheckeddimgFins);
                  fins.setDisabledSelectedIcon(uncheckeddimgFins);
                  fins.setSelected(false);
                  
                JCheckBox legs = new JCheckBox();
                ImageIcon checkeddimglegs = new ImageIcon("./images/legsCheck.png");
                ImageIcon uncheckeddimglegs = new ImageIcon("./images/legsUnCheck.png");

                  legs.setIcon(uncheckeddimglegs);
                  legs.setSelectedIcon(checkeddimglegs);
                  legs.setDisabledIcon(uncheckeddimglegs);
                  legs.setDisabledIcon(uncheckeddimglegs);
                  legs.setDisabledSelectedIcon(uncheckeddimglegs);
                  legs.setSelected(false);
                  
                JCheckBox tail = new JCheckBox();
                ImageIcon checkeddimgTail = new ImageIcon("./images/tailCheck.png");
                ImageIcon uncheckeddimgTail = new ImageIcon("./images/tailUnCheck.png");

                  tail.setIcon(uncheckeddimgTail);
                  tail.setSelectedIcon(checkeddimgTail);
                  tail.setDisabledIcon(uncheckeddimgTail);
                  tail.setDisabledIcon(uncheckeddimgTail);
                  tail.setDisabledSelectedIcon(uncheckeddimgTail);
                  tail.setSelected(false);
                  
                JCheckBox domestic = new JCheckBox();
                ImageIcon checkeddimgDomestic = new ImageIcon("./images/domesticCheck.png");
                ImageIcon uncheckeddimgDomestic = new ImageIcon("./images/domesticUnCheck.png");

                  domestic.setIcon(uncheckeddimgDomestic);
                  domestic.setSelectedIcon(checkeddimgDomestic);
                  domestic.setDisabledIcon(uncheckeddimgDomestic);
                  domestic.setDisabledIcon(uncheckeddimgDomestic);
                  domestic.setDisabledSelectedIcon(uncheckeddimgDomestic);
                  domestic.setSelected(false);
                  
                JCheckBox catsize = new JCheckBox();
                ImageIcon checkeddimgCatsize = new ImageIcon("./images/catsizeCheck.png");
                ImageIcon uncheckeddimgCatsize = new ImageIcon("./images/catsizeUnCheck.png");

                  catsize.setIcon(uncheckeddimgCatsize);
                  catsize.setSelectedIcon(checkeddimgCatsize);
                  catsize.setDisabledIcon(uncheckeddimgCatsize);
                  catsize.setDisabledIcon(uncheckeddimgCatsize);
                  catsize.setDisabledSelectedIcon(uncheckeddimgCatsize);
                  catsize.setSelected(false);
                  
                /**********************************************************/
                JLabel label = new JLabel("Animal");
                JTextField textField = new JTextField();
                textField.setSize(15, 2);
                //FlowLayout layoutF = new FlowLayout();
                //JPanel pan = new JPanel(layoutF);
                //JPanel pan2 = new JPanel(new GridLayout(10,1));
                panel.add(label);
                panel.add(textField);
               // form.add(pan);
                
                
                panel.add(tail);
                panel.add(hair);
                panel.add(feathers);
                panel.add(eggs);
                panel.add(milk);
                panel.add(airborne);
                panel.add(aquatic);
                panel.add(predator);
                panel.add(toothed);
                panel.add(backbone);
                panel.add(breathes);
                panel.add(venomous);
                panel.add(fins);
                panel.add(legs);
                panel.add(domestic);
                panel.add(catsize);
                JButton valider = new JButton("Valider");
                JComboBox list = new JComboBox();
                list.addItem("mamal");
                list.addItem("fish");
                list.addItem("bird");
                list.addItem("invertebrate");
                list.addItem("insect");
                list.addItem("amphibian");
                panel.add(valider);
                panel.add(list);
              
                
                /********************************************************/
                panel.setBorder(borderForm);
                //JPanel arbre = new JPanel();
                
                
                
                //panel.add(arbre);
                return panel;
	}    
}
